<?php
/*
Plugin Name: News
Plugin URI: 
Version: v1.0
Author: <a href="http://huynhuan.wordpress.com">HuanHH</a>
Description: Power by Cao Dang Nghe Long An.
*/
?>
<?php 
class News extends WP_Widget {

	function News() {
		$widget_ops = array('classname' => 'news', 'description' => 'News' );
		$control_ops = array ('width' => '200', 'height' => '400');
		$this->WP_Widget('news', 'News', $widget_ops, $control_ops);
	}
	
	function widget($args, $instance) {
		extract($args);
		extract($instance);
		?>
		<div id="box_center">
			<div class="top">
				<div class="title"><?php print $title?></div>
			</div>
			<div class="center">
				
			</div>
			<div class="bot"></div>
		</div>
		<?php
	}

	function update($new_instance, $old_instance) {
		$instance = $old_instance;

		$title = $new_instance['title'];
		
		$instance = compact('title');
		return $instance;
	}

	function form($instance) {
		$defaults=array(
			'title' => __('Tin tức', 'cdnla')
		);
		
		$options = wp_parse_args($instance, $defaults);
		extract($options);

		?>

		<div>
			<div>Title:</div>
			<div><input  id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></div>
		</div>

		<?php
	}
}

if (class_exists("News")) {
	$news = new News();
}

function register_news() {
	register_widget('News');
}
add_action('widgets_init', 'register_news');

?>
